package com.guigu.liuzhireng.controller;

import com.guigu.aop.OpLog;
import com.guigu.liuzhireng.pojo.Authorization;
import com.guigu.liuzhireng.pojo.PageVo;
import com.guigu.liuzhireng.service.AuthorizationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("Authorization.do")
public class AuthorizationController {

    @Autowired
    AuthorizationService authorizationService;

    @RequestMapping("Page")
    @ResponseBody
    public PageVo<Authorization> Page(@RequestBody PageVo<Authorization> pageVo){
        return authorizationService.Page(pageVo.getObj(),pageVo.getNum(),pageVo.getSize());
    }

    @RequestMapping("Add")
    @OpLog(opModule = "权限信息模块",operType = "添加权限信息",operDesc = "此方法用于添加权限信息")
    public String Add(Authorization authorization){
        int i = authorizationService.insert(authorization);
        return "/authorization/Authorization.html";
    }

    @RequestMapping("UpDate")
    @OpLog(opModule = "权限信息模块",operType = "修改权限信息",operDesc = "此方法用于修改权限信息")
    public String UpDate(Authorization authorization){
        int i = authorizationService.update(authorization);
        return "/authorization/Authorization.html";
    }

    @RequestMapping("Delete")
    @OpLog(opModule = "权限信息模块",operType = "删除权限信息",operDesc = "此方法用于删除权限信息")
    public String Delete(Integer id){
        int i = authorizationService.delete(id);
        return "/authorization/Authorization.html";
    }
}
